﻿YAHOO.namespace("example.container");
function init() {
    var handleSubmit = function () {

        var editwindow = document.getElementById("EditUIWindow");
        if (editwindow) {
            editwindow.contentWindow.Save();
            alert("设置成功");
            this.cancel();
            ReLoadData();
        }

    };
    var handleCancel = function () {
        this.cancel();
    };
    var handleSuccess = function (o) {
        var response = o.responseText;
        response = response.split("<!")[0];
        document.getElementById("resp").innerHTML = response;
    };
    var handleFailure = function (o) {
        alert("Submission failed: " + o.status);
    };
    var handleCancel1 = function () {
        this.cancel();
    };
    var callback =
        {
            success: handleSuccess1,
            failure: handleFailure1,
            argument: { foo: "foo", bar: "bar" }
        };
    var handleSubmit1 = function () {
        var editwindow1 = document.getElementById("EditUIWindow1");
        if (editwindow1) {
            editwindow1.contentWindow.Save();
        }
        alert("设置成功");
        this.cancel();
    };
    var handleSuccess1 = function (o) {
        alert("设置成功");
        this.cancel();
    };
    var handleFailure1 = function (o) {
        alert("操作失败");
    };
    // Remove progressively enhanced content class, just before creating the module
    YAHOO.util.Dom.removeClass("dialog1", "yui-pe-content");
    // Instantiate the Dialog
    YAHOO.example.container.dialog1 = new YAHOO.widget.Dialog("dialog1",
							{ width: "450px",
							    height: "300px",
							    fixedcenter: true,
							    draggable: true,
							    close: true,
							    visible: false,
							    constraintoviewport: true,
							    buttons: [{ text: "保存", handler: handleSubmit, isDefault: true },
								      { text: "取消", handler: handleCancel}]
							});
      YAHOO.example.container.dialog1.render();
  };
  YAHOO.util.Event.addListener(window, "load", init);
